package productConsumerTest;

import java.util.Stack;

public class Container1 {
		Stack<String> goodss = new Stack<String>();
		public synchronized void push(String goods){
			goodss.push(goods);
			notifyAll();
			System.out.println(goods);
		}
		public synchronized String pop(){
			if(goodss.size() > 0){
				return goodss.pop();
			}else{
				try {
					wait();
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				return null;
			}
		}
		
}
